
rm(list = ls(all.names = TRUE)) 
gc() 


data <- read.csv("intermediary_outputs/base_with_connection_data.csv")

ind_controls <- paste("male", "factor(religion_simple)", 
                      "age_grade_distortion", "score_self_esteem", 
                      "score_parents_support", "score_study", sep = "+")

ses_controls <- paste("scores_poverty", "score_neighborhood_quality", 
                      "factor(occ_father_simple_no_job_no_na)",
                      "factor(occ_mother_simple_no_job_no_na)", sep = "+")

class_fe <- paste("factor(class_id)")

# Support functions
source("robustness/01_support_robustness_en.R", encoding = "UTF-8")

# Skin color (S8)
source("robustness/02_robustness_skin_group_en.R", encoding = "UTF-8")

# Race and skin color interactions (S9)
source("robustness/03_robustness_skin_color_interaction_en.R", encoding = "UTF-8")

# Race: White, black, brown (S10-S11)
source("robustness/04_robustness_race_simple_1_en.R", encoding = "UTF-8")

# Supply of friends (S12)
source("robustness/05_robustness_separate_regs_en.R", encoding = "UTF-8")

# Supply of friends (S13)
source("robustness/06_robustness_supply_en.R", encoding = "UTF-8")

# Other Dependent Variables (S14)
source("robustness/07_robustness_other_dep_vars_en.R", encoding = "UTF-8")

# Prepare data for robustness check on sample selection:
dir.create("intermediary_outputs/robustness")
source("robustness/08_robust_descriptive_en.R", encoding = "UTF-8")

# This one takes a while...
source("robustness/09_compute_index_robust_descriptive_en.R", encoding = "UTF-8")

# Prepare tables and regressions (S2, S3, S15)
source("robustness/10_robustness_sample_en.R", encoding = "UTF-8")
